marker = createMarker(2353.44580, -650.27271, 129.8781-0.9, "cylinder", 1, 100, 0, 255, 0)

function hit(el,md)
    if not md or getElementType(el) ~= "player" then return end
        if isPedInVehicle(el) then return end
        local time = getRealTime()
        local hours = time.hour
        if hours > 10 and hours < 18 then
            exports["cmta-notyfikacje"]:add(el,"Przyjdź później, dostawy są od 18:00 do 10:00", 5000, 10, tocolor(255, 255, 255), tocolor(255,0,0, 155))
        return end
        if getElementData(el,"player:lvl") < 25 then
            exports["cmta-notyfikacje"]:add(el,"Musisz mieć 25 poziom, aby porozmawiać", 5000, 10, tocolor(255, 255, 255), tocolor(255,0,0, 155))
        return end
        triggerClientEvent(el,'cmta_diler:showGUI',resourceRoot)
    end
addEventHandler( "onMarkerHit", marker, hit)

function leave(el,md)
    if not md or getElementType(el) ~= "player" then return end
        triggerClientEvent(el,'cmta_diler:hideGUI',resourceRoot)
    end
addEventHandler( "onMarkerLeave", marker, leave)

addEvent('cmta_diler:kup',true)
addEventHandler('cmta_diler:kup',resourceRoot,function(who,amount)
if who == "papierosy" then
    if getElementData(client,"player:points") < 20*amount then exports["cmta-notyfikacje"]:add(client,"Nie masz tyle punktów.", 5000, 10, tocolor(255, 255, 255), tocolor(255,0,0, 155)) return end
    exports["cmta-db"]:dbSet("update cmta_inventory set cigarettes=cigarettes+? where uid=?",amount,getElementData(client,"player:uid"))
    setElementData(client,"player:points",getElementData(client,"player:points")-(20*amount))
    triggerClientEvent(client,'cmta_diler:animation',resourceRoot)
    if amount == 1 then
    exports["cmta-notyfikacje"]:add(client,"Kupiłeś 1x papierosy", 5000, 10, tocolor(255, 255, 255), tocolor(0,255,0, 155))
    else
    exports["cmta-notyfikacje"]:add(client,"Kupiłeś 5x papierosy", 5000, 10, tocolor(255, 255, 255), tocolor(0,255,0, 155))
    end
elseif who == "marihuana" then
    if getElementData(client,"player:points") < 50*amount then exports["cmta-notyfikacje"]:add(client,"Nie masz tyle punktów.", 5000, 10, tocolor(255, 255, 255), tocolor(255,0,0, 155)) return end
    exports["cmta-db"]:dbSet("update cmta_inventory set marihuana=marihuana+? where uid=?",amount,getElementData(client,"player:uid"))
    setElementData(client,"player:points",getElementData(client,"player:points")-(50*amount))
    triggerClientEvent(client,'cmta_diler:animation',resourceRoot)
    if amount == 1 then
    exports["cmta-notyfikacje"]:add(client,"Kupiłeś 1x marihuana", 5000, 10, tocolor(255, 255, 255), tocolor(0,255,0, 155))
    else
    exports["cmta-notyfikacje"]:add(client,"Kupiłeś 5x marihuana", 5000, 10, tocolor(255, 255, 255), tocolor(0,255,0, 155))
    end
end
end)